package com.meiyue.controller;

import com.meiyue.bean.entity.UserModel;
import com.meiyue.bean.protocol.NetResult;
import com.meiyue.library.utils.ResultUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * MeiyueJavaProject
 * com.meiyue.controller
 * Created by Chris Chen
 * 2017/9/14
 * Explain:做模拟数据
 */
@RestController
@RequestMapping("/home")
public class HomeController {
    @RequestMapping("/getUserList")
    public NetResult<List<UserModel>> getUserList() {
        List<UserModel> userModels = new ArrayList<>();
        UserModel userModel;
        for (int i = 0; i < 40; i++) {
            userModel = new UserModel();
            userModel.id = i + 1;
            userModel.name = "用户姓名" + (i + 1);
            userModel.age = 56;
            userModels.add(userModel);
        }
        return ResultUtils.buildResult(userModels);
    }
}
